package edu.utdallas.cs.securechat.ui;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import edu.utdallas.cs.securechat.main.Client;

public class ClientFrame extends JFrame{
	private static final long serialVersionUID = 1L;
	private LoginDialog login;
	boolean loggedIn = false;
	Client c = null;

	public ClientFrame(String serverDomainName){
		c = new Client();
		c.setServerDomainName(serverDomainName);
		c.getServerPublicKey();
	}
	
	public void startClient(){
		login = new LoginDialog(this);
		if(login.login()) {
			ClientPanel mainPanel = new ClientPanel(this);
			mainPanel.createAndShowGUI();
		} else {
			JOptionPane.showMessageDialog(null,"Thank you, Come again!","Invalid login",JOptionPane.ERROR_MESSAGE);
			System.exit(0);
		}
	}
	
	public Client getClient(){
		return c;
	}
}


